home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume23 / asp / part01 next >
Encoding:
Text File  |  1991-10-16  |  57.5 KB  |  2,079 lines

  1. Newsgroups: comp.sources.misc
  2. From: aem@aber.ac.uk (Alec Muffett)
  3. Subject:  v23i031:  asp - The .plan description language, Part01/02
  4. Message-ID: <csm-v23i031=asp.150146@sparky.IMD.Sterling.COM>
  5. X-Md4-Signature: a582a60603763ef13c5629272c6fcb40
  6. Date: Fri, 27 Sep 1991 20:03:13 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: aem@aber.ac.uk (Alec Muffett)
  10. Posting-number: Volume 23, Issue 31
  11. Archive-name: asp/part01
  12. Environment: UNIX
  13.  
  14. [ The message "Remain Calm" comes to mind... :-)  -Kent+ ]
  15.  
  16. This is "Asp v3.2, The .plan description language".
  17. From the README:
  18.  
  19. > Asp is a simplistic description language for carriage-return based ascii
  20. > animations, as commonly found in ".plan" files when you finger someone.
  21. > It is simple to use, so large, smooth, neat animations can be built
  22. > quickly and easily, and with a lot of room for imagination.
  23.  
  24. Asp is a simple, rule-based language for generating those wonderful
  25. scrolling ".plan" files that many people have written diddy programs to
  26. generate.  Asp was desigend to do go "one bit further" that those
  27. programs usually do, and to be flexible with it.  It seems to achieve
  28. this end.
  29.  
  30. I hope you have fun with it.  The most obvious problem you might have is
  31. the standard index()/strchr() incompatibility.  Check "asp.h"
  32.  
  33. alec
  34. ---
  35. #!/bin/sh
  36. # This is a shell archive.  Remove anything before this line, then unpack
  37. # it by saving it into a file and typing "sh file".  To overwrite existing
  38. # files, type "sh file -c".  You can also feed this as standard input via
  39. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  40. # will see the following message at the end:
  41. #        "End of archive 1 (of 2)."
  42. # Contents:  COVER_LETTER MANIFEST Makefile README anim.c asp.c asp.h
  43. #   copy.c demo1.asp demo2.asp demo3.asp demo4.asp demo5.asp display.c
  44. # Wrapped by aem@aberda on Wed Sep 25 11:26:45 1991
  45. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  46. if test -f 'COVER_LETTER' -a "${1}" != "-c" ; then 
  47.   echo shar: Will not clobber existing file \"'COVER_LETTER'\"
  48. else
  49. echo shar: Extracting \"'COVER_LETTER'\" \(1014 characters\)
  50. sed "s/^X//" >'COVER_LETTER' <<'END_OF_FILE'
  51. XThis is "Asp v3.2, The .plan description language"
  52. X
  53. XFrom the README:
  54. X
  55. X> Asp is a simplistic description language for carriage-return based ascii
  56. X> animations, as commonly found in ".plan" files when you finger someone.
  57. X> It is simple to use, so large, smooth, neat animations can be built
  58. X> quickly and easily, and with a lot of room for imagination.
  59. X
  60. XAsp is a simple, rule-based language for generating those wonderful
  61. Xscrolling ".plan" files that many people have written diddy programs to
  62. Xgenerate.  Asp was desigend to do go "one bit further" that those
  63. Xprograms usually do, and to be flexible with it.  It seems to achieve
  64. Xthis end.
  65. X
  66. XI hope you have fun with it.  The most obvious problem you might have is
  67. Xthe standard index()/strchr() incompatibility.  Check "asp.h"
  68. X
  69. Xalec
  70. X--
  71. XINET: aem@aber.ac.uk      JANET: aem@uk.ac.aber      BITNET: aem%aber@ukacrl
  72. XUUCP: ...!mcsun!ukc!aber!aem         ARPA: aem%uk.ac.aber@nsfnet-relay.ac.uk
  73. XSNAIL: Alec Muffett, Computer Unit, Llandinam UCW, Aberystwyth, UK, SY23 3DB
  74. END_OF_FILE
  75. if test 1014 -ne `wc -c <'COVER_LETTER'`; then
  76.     echo shar: \"'COVER_LETTER'\" unpacked with wrong size!
  77. fi
  78. # end of 'COVER_LETTER'
  79. fi
  80. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  81.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  82. else
  83. echo shar: Extracting \"'MANIFEST'\" \(897 characters\)
  84. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  85. X   File Name        Archive #    Description
  86. X-----------------------------------------------------------
  87. X COVER_LETTER               1    letter to go with distribution
  88. X MANIFEST                   1    This file
  89. X Makefile                   1    Makefile (Oh, come on!!!)
  90. X README                     1    documentation on programming ASP
  91. X anim.c                     1    animation primitives
  92. X asp.c                      1    main()
  93. X asp.h                      1    header file with major declarations
  94. X copy.c                     1    string copying primitives
  95. X demo1.asp                  1    demo 1 of asp in action 
  96. X demo2.asp                  1    demo 2 of asp in action 
  97. X demo3.asp                  1    demo 3 of asp in action 
  98. X demo4.asp                  1    demo 4 of asp in action 
  99. X demo5.asp                  1    demo 5 of asp in action 
  100. X display.c                  1    display primitives 
  101. X effects.c                  2    special effects
  102. END_OF_FILE
  103. if test 897 -ne `wc -c <'MANIFEST'`; then
  104.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  105. fi
  106. # end of 'MANIFEST'
  107. fi
  108. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  109.   echo shar: Will not clobber existing file \"'Makefile'\"
  110. else
  111. echo shar: Extracting \"'Makefile'\" \(315 characters\)
  112. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  113. XEXE=        asp
  114. XCFLAGS=        -g
  115. XOBJECTS=    anim.o asp.o copy.o display.o effects.o
  116. X
  117. Xdemo:    $(EXE)
  118. X    $(EXE) demo1.asp 2> /dev/null
  119. X    $(EXE) demo2.asp 2> /dev/null
  120. X    $(EXE) demo3.asp 2> /dev/null
  121. X    $(EXE) demo4.asp 2> /dev/null
  122. X    $(EXE) demo5.asp 2> /dev/null
  123. X
  124. X$(EXE):    $(OBJECTS)
  125. X    cc $(CFLAGS) -o $@ $(OBJECTS)
  126. X
  127. Xclean:
  128. X    rm -f *.o asp 
  129. END_OF_FILE
  130. if test 315 -ne `wc -c <'Makefile'`; then
  131.     echo shar: \"'Makefile'\" unpacked with wrong size!
  132. fi
  133. # end of 'Makefile'
  134. fi
  135. if test -f 'README' -a "${1}" != "-c" ; then 
  136.   echo shar: Will not clobber existing file \"'README'\"
  137. else
  138. echo shar: Extracting \"'README'\" \(13120 characters\)
  139. sed "s/^X//" >'README' <<'END_OF_FILE'
  140. X*** Documentation for "asp v3.2, The .plan description language"
  141. X(c) Alec Muffett, September 1991
  142. X
  143. XAs detailed in the demonstration programs (just type 'make'), this is
  144. X"asp", Alec's Scrolling Program, a diddy little hack I put together to
  145. Xfinish a war over who could make the longest, best, and prettiest
  146. X".plan" files, using only the printable ascii character set.
  147. X
  148. XAsp is a simplistic description language for carriage-return based ascii
  149. Xanimations, as commonly found in ".plan" files when you finger someone.
  150. XIt is simple to use, so large, smooth, neat animations can be built
  151. Xquickly and easily, and with a lot of room for imagination.
  152. X
  153. XThe language is crude, I haven't put together a decent lexical analyser,
  154. Xthere is no real parser as such, to whit, it is a realio trulio hack, as
  155. Xstated before.
  156. X
  157. XThe language divides roughly into three sections: boring effects,
  158. Xspecial effects, and directives.  A good idea of how they work can be
  159. Xobtained from the demo files supplied with this distribution, but here's
  160. Xa little primer anyway:-
  161. X
  162. X*** Primer
  163. X
  164. XAsp works by reading a "asp program" which is full of "rules" and
  165. X"data".  A "rule" line is made up of a series of "commands", all of
  166. Xwhich begin with a "." character.  With me so far ?
  167. X
  168. XSo, for example, a "rule" line might look like:-
  169. X
  170. X.clear .p .p .show .p .p
  171. X
  172. XSince the commands all begin with a dot, the rule line begins with a dot
  173. Xalso.  Any line which begins with a dot in an asp program is assumed to
  174. Xbe a "rule" line.  If a rule line is too long for convenience's sake, it
  175. Xmay be broken with a backslash at the end of the line, in the same way
  176. Xas in C and shell scripts, eg:
  177. X
  178. X.speed 2 \
  179. X.object his -30 40 \
  180. X.object dreams, -50 44 \
  181. X.object computer -15 22 \
  182. X.object he -2 58 \
  183. X.object ? -250 61 \
  184. X.object can 89 31 \
  185. X.object have 100 35 \
  186. X.object can 111 52 \
  187. X.object A 150 20 \
  188. X.object 't 200 55 \
  189. X.anim .resetanim .p .p .p .nl
  190. X
  191. X- is a single rule line.  When a valid rule line is encountered, it is
  192. Xstored in memory and becomes the "current rule".
  193. X
  194. XNext, Data lines.  Any non-blank line which is not a rule line, is a
  195. X"data line".  When a data line is encountered, asp applies all the
  196. Xcommands specified in the current rule to the data line, and then moves
  197. Xonto the next data line. eg:
  198. X
  199. X.show .nl
  200. XHello World!
  201. X
  202. XWill print the line "Hello World!" (.show), and throw a linefeed (.nl).
  203. X
  204. XBlank lines in an asp program are ignored, and so, on occasions, dummy
  205. Xdata lines must be supplied to asp in order to get a rule to do
  206. Xanything.  The traditional dummy line consists of two hyphens on a line
  207. Xof their own, eg:
  208. X
  209. X.p .p .p
  210. X--
  211. X
  212. XInvokes the Pause function (.p) three times.  If there were no dummy
  213. Xline before the next rule was specified, the command would be ignored.
  214. XNote that the Pause function does not print anything on the standard
  215. Xoutput, so the appearance of the line is not changed.
  216. X
  217. XSimilarly, the command:
  218. X
  219. X.p .p .p
  220. X--
  221. X--
  222. X--
  223. X
  224. XInvokes Pause nine times, three times for each dummy line.
  225. X
  226. XNext, asp internals.  Asp pinches an idea from the curses library, in
  227. Xthat it stores a copy of what the current output line looks like, and
  228. Xthen prints only the differences between the current line and what you
  229. Xwant it to look like.  This "optimised refresh" improves on how an asp
  230. Xprogram looks when you view it, and also on the size of the output file
  231. Xasp generates compared to other scrolling programs.
  232. X
  233. XYou should also note that asp does not begin processing of a program
  234. Xuntil it encounters the first "rule line".  Up to that point it behaves
  235. Xin the same way as the 'cat' program, copying the program to stdout.
  236. XThis allows you to embed a lot of plain text in your program before you
  237. Xstart scrolling things about.
  238. X
  239. X*** Undercoat
  240. X
  241. XThe above gives a fairly simple introduction to how asp works. Now for a
  242. Xdescription of commands in detail.
  243. X
  244. XThe asp commands break down into three rough types: Boring effects,
  245. XSpecial effects, and Directives.  Some of these take arguments, which
  246. Xare either VALUES, BOOLEANS, or STRINGS.
  247. X
  248. XValues are basically any integer quantity, positive or negative.
  249. X
  250. XBooleans are the same as values, where 0=FALSE and Non-0=TRUE.
  251. X
  252. XStrings are continuous sets of characters which do not contain
  253. Xwhitespace (I haven't bothered in putting an escaping mechanism for
  254. Xspaces yet.)
  255. X
  256. XThere may be a problem if you specify a string as an argument to a
  257. Xcommand, and the string happens to begin with a dot - asp will, at some
  258. Xpoint, try to treat it as a command.  Don't worry about this, it will
  259. Xprobably work out okay, and I'll fix it in due course.
  260. X
  261. XFinally, please note that asp uses only columns 0->78 of the screen,
  262. Xbecause some terminals will wrap immediately you write a character into
  263. Xcolumn 79, and this spoils the fun...
  264. X
  265. XIMPORTANT: Asp does not expand TABs in asp programs.  Run your program
  266. Xthrough "expand" before feeding it into "asp".
  267. X
  268. X*** Topcoat
  269. X
  270. XHere is a list of asp directives and effects, their function and arguments:
  271. X
  272. X-------------------------------
  273. XDIRECTIVES AND BORING EFFECTS:-
  274. X-------------------------------
  275. X    .clear
  276. X
  277. XWipes the current line clear and refreshes it, so as to put a blank line
  278. Xon screen.
  279. X-------------------------------
  280. X    .wipe
  281. X
  282. XWipes the current line clear without refreshing it, so that the next
  283. Xcommand does not have to worry about the mess left by previous lines.
  284. X
  285. XThis command is probably best tagged onto the beginning of every rule
  286. Xwhere you do not want to have to specifically overstrike anything that
  287. Xwas left by the previous rule & data.
  288. X-------------------------------
  289. X    .nl
  290. X
  291. XThrows a newline.  Please note that the default action of asp once it
  292. Xhas acquired a rule it to print EVERYTHING without newlines, so you must
  293. Xbe explicit about where you want them.
  294. X-------------------------------
  295. X    .show
  296. X
  297. XDoes a .wipe and then prints the current line on screen.  This is the
  298. Xmost basic of the output primitives, and you will probably use this a
  299. Xlot.
  300. X-------------------------------
  301. X    .p
  302. X
  303. XGenerates a pause in the display by firing approximately 2Kb of carriage
  304. Xreturns at your screen (roughly 1 second at 9600 baud).  See also
  305. X".speed" below. 
  306. X-------------------------------
  307. X    .noop
  308. X
  309. XDoes bugger all.
  310. X-------------------------------
  311. X    .flush
  312. X
  313. XIs a nice one.  It deletes the current rule from asp's memory, so it's
  314. Xbehaviour is once again like 'cat' (check the 'Undercoat' section,
  315. Xabove).  This means you can embed small bits of asp code in any text
  316. Xfile, without having to modify the rest of the file to get it through
  317. Xthe asp processor.  Do NOT forget to invoke ".flush" with a dummy data
  318. Xline, though:
  319. X
  320. XThis is a bit of cat'ted text.
  321. X.speed 3 .spatter .p .p .p .nl
  322. XThis is a somewhat longer bit of asp'ed text
  323. X.flush
  324. X--
  325. XThis is another bit of cat'ted text.
  326. X
  327. X- ok ?
  328. X-------------------------------
  329. X    .smooth BOOLEAN
  330. X
  331. XSwitches on 80-character smoothing mode.  This is useful where you are
  332. Xgoing to be scrolling small bits of text back and forth across the
  333. Xscreen.  If you do not have smoothing on, asp will generate code which
  334. Xwill make the object move faster towards the left hand side of the
  335. Xscreen.  This is due to the optimised refresh code mentioned above.
  336. X
  337. XIf smoothing is swithched on (".smooth 1"), asp pads out (with carriage
  338. Xreturns) each line that it prints in order to remedy this situation.
  339. XThis leads to smoother, neater animations.
  340. X-------------------------------
  341. X    .speed VALUE
  342. X
  343. XThis is a speed adjustment function which pads out each line that asp
  344. Xsends, in order to cope with fast terminals, and for special effects.
  345. X
  346. XThe default is ".speed 0" and as the speed value is increased, each line
  347. Xis padded with 'x' carriage returns (x = 8 * n, where 'n' is the
  348. Xargument to ".speed").  The higher the value, the slower it goes.
  349. X
  350. XBe judicious with your use of .speed - remember, some people still work
  351. Xat under 1200 baud.
  352. X-------------------------------
  353. X    .background
  354. X    .foreground
  355. X
  356. XThese are both commands which break the rules outlined above.  They both
  357. Xread the next line DIRECTLY BENEATH the command into special buffers for
  358. Xuse during output.  It does not matter whether this line is blank or
  359. Xnot, and indeed, a blank line will be necessary to reset the buffer to a
  360. Xblank when desired.
  361. X
  362. X".background" and ".foreground" load their following line into a
  363. Xbackground or foreground buffer respectively.  The buffer will then be
  364. Xused either be used as a backdrop or overlay mask for whatever is
  365. Xprinted from then on.  This means that you don't have to worry about
  366. Xyour landscapes getting corrupted, having to redraw them, and so on.
  367. X
  368. XAs an example, see the two occurances of ".background" in "demo2.asp"
  369. X-------------------------------
  370. XSPECIAL EFFECTS:-
  371. X-------------------------------
  372. X    .fade
  373. X
  374. XPrints the message on the screen and fades it one character at a time.
  375. XTo get slower fades, whack the speed up either side of it, eg:
  376. X
  377. X.show .p .p .speed 10 .fade .speed 0 .p
  378. X    This piece of text should fade quite gradually into nothingness...
  379. X
  380. X-------------------------------
  381. X    .flash
  382. X
  383. XFlashes all the text in a data line several times before moving onto the
  384. Xnext. Does not overstrike text with whitespace, and can be used thusly:
  385. X
  386. X.show
  387. X"Beep Beep", went the little car's horn.
  388. X.speed 20 .flash .speed 0
  389. X Beep Beep
  390. X
  391. X-------------------------------
  392. X    .layb
  393. X    .layetm
  394. X    .laymte
  395. X    .layf
  396. X
  397. XPrints the line by laying down one character at a time, backwards,
  398. Xends-to-middle, middle-to-ends, or forwards, respectively.  See the
  399. Xdemos for examples.
  400. X-------------------------------
  401. X    .tshow
  402. X
  403. XIs like ".show" but does not call ".wipe", and it uses transparent
  404. Xwhitespace, ie: whitespace in the data line does not overstrike any
  405. Xprintable character that is already on screen.  eg:
  406. X
  407. X.tshow .p
  408. X                                 LIFE
  409. X                                      ON
  410. X                                         UNIX
  411. X
  412. X-------------------------------
  413. X    .letter1
  414. X    .letter2
  415. X    .letter3
  416. X
  417. XAre effects macros based on the "let's-cycle-through-the-ascii-character-set"
  418. Xprinciple. See the demos for examples.
  419. X-------------------------------
  420. X    .scrollb
  421. X    .scrollf
  422. X
  423. XScrolls the data line backwards or forwards (respectively) onto the
  424. Xscreen, overstriking what is already there, eg:
  425. X
  426. X.scrollb .p .p
  427. XThis message will scroll from right to left across the width of the screen
  428. XThis message will also scroll from right to left.
  429. X
  430. X-------------------------------
  431. X    .scrollob
  432. X    .scrollof
  433. X
  434. XLike .scroll[bf], but these commands scroll what it already there off of
  435. Xthe screen, rather than overstriking it.  See the demos for examples.
  436. X
  437. X.scrollob .p .p
  438. XThis message will scroll from right to left across the width of the screen
  439. XThis message will also scroll from right to left, without overstriking.
  440. X
  441. X-------------------------------
  442. X    .spatter
  443. X    .wspatter
  444. X
  445. X".spatter" is the opposite of ".fade".  ".wspatter" is similar, but
  446. Xspatters whole words onto the screen, rather than characters.
  447. X-------------------------------
  448. X    .object STRING1 VALUE1 VALUE2
  449. X    .anim
  450. X    .resetanim
  451. X
  452. XThese are the three Asp animation primitives.
  453. X
  454. XBasically, the idea of an animation is to build up a series of "objects"
  455. Xusing the ".object" directive.  This specifies that you want to move
  456. X"STRING1" from position VALUE1 to position VALUE2, where the value is
  457. Xbetween +/-37267 (or possibly larger), and position 0 is the left hand
  458. Xcolumn of the screen, position 78 the right hand corner of the screen.
  459. X
  460. XAfter specifying the series of objects to be animated, the animation is
  461. Xrun by invoking the ".anim" command.  Once you are finished with the
  462. Xanimation, you delete the objects from the screen by the ".resetanim"
  463. Xcommand.  Simple, eh ? Here's the lorry animation from demo1.asp:
  464. X
  465. X.object oo-oP -15 80 .anim .resetanim .p
  466. X--
  467. X
  468. XClever people will see that if you want to produce delays and odd timing
  469. Xeffects, you merely have to start an object a long way away from it's
  470. Xdestination.  eg: several lorries-
  471. X
  472. X.object oo-oP -15 80 \
  473. X.object oo-oP -21 80 \
  474. X.object oo-oP -27 80 \
  475. X.object oo-oP -33 80 \
  476. X.object oo-oP -39 80 \
  477. X.object ooo-----ooP -45 80 \
  478. X.anim .resetanim .p
  479. X--
  480. X
  481. XBecause their nature is that of a sort of "compound command", several
  482. Xanimations can be built into a single rule and then fired off upon
  483. Xmultiple data lines.  Add a few extra dummy lines to the animation above
  484. Xto get a whole convoy.  (see also the "flying arrows" in demos 3 & 5).
  485. X
  486. XFor the technically minded, asp animations run in an entirely separate
  487. Xbuffer from the rest of asp.  The buffer lies in the second position
  488. Xthus:-
  489. X
  490. X                USER VIEW
  491. X                    |
  492. X                    V
  493. X                FOREGROUND BUFFER
  494. X                ANIMATIONS BUFFER
  495. X               RULE BUFFER (STDLINE)
  496. X                BACKGROUND BUFFER
  497. X
  498. XHence, what you do in an animation cannot affect the rule buffer (ie:
  499. Xwhere your data lines end up after being processed by a rule), nor the
  500. Xforegrounds and backgrounds.
  501. X
  502. X*** Usage
  503. X
  504. XNow for the easy bit: for your file "aspprog.asp";
  505. X
  506. X        asp aspprog.asp > $HOME/.plan
  507. X
  508. Xor, if you must use tabs
  509. X
  510. X        expand < aspprog.asp | asp > $HOME/.plan
  511. X
  512. XBugs, reports, suggestions, patches to the address below...
  513. X
  514. X                        alec 8-)
  515. X--
  516. XINET: aem@aber.ac.uk      JANET: aem@uk.ac.aber      BITNET: aem%aber@ukacrl
  517. XUUCP: ...!mcsun!ukc!aber!aem         ARPA: aem%uk.ac.aber@nsfnet-relay.ac.uk
  518. XSNAIL: Alec Muffett, Computer Unit, Llandinam UCW, Aberystwyth, UK, SY23 3DB
  519. END_OF_FILE
  520. if test 13120 -ne `wc -c <'README'`; then
  521.     echo shar: \"'README'\" unpacked with wrong size!
  522. fi
  523. # end of 'README'
  524. fi
  525. if test -f 'anim.c' -a "${1}" != "-c" ; then 
  526.   echo shar: Will not clobber existing file \"'anim.c'\"
  527. else
  528. echo shar: Extracting \"'anim.c'\" \(1621 characters\)
  529. sed "s/^X//" >'anim.c' <<'END_OF_FILE'
  530. X/*
  531. X * This code is copyright ADE Muffett, September 1991, and is distributed as
  532. X * part of the ASP .plan description language compiler.  This code is freely
  533. X * redistributable as long as this copyright notice remains intact. No
  534. X * responsibility is assumed by the author for any situation which arises
  535. X * from the use of this code, including insanity, late nights, or disk
  536. X * storage problems.
  537. X */
  538. X
  539. X#include "asp.h"
  540. X
  541. Xvoid
  542. XAddObject (string)
  543. X    char *string;
  544. X{
  545. X    register int i;
  546. X    int start;
  547. X    int finish;
  548. X    char buff[SCREENWIDTH];
  549. X    char *obj;
  550. X
  551. X    sscanf (string, "%*s %s %d %d", buff, &start, &finish);
  552. X
  553. X    obj = CopyString (buff);
  554. X
  555. X    for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++);
  556. X
  557. X    aobjects[i].object = obj;
  558. X    aobjects[i].location = start;
  559. X    aobjects[i].destination = finish;
  560. X    aobjects[++i].object = NULL;
  561. X}
  562. X
  563. Xvoid
  564. XResetAnim ()
  565. X{
  566. X    aobjects[0].object = NULL;
  567. X    NullSet (anim_buffer, sizeof (anim_buffer));
  568. X}
  569. X
  570. Xvoid
  571. XAnimate ()
  572. X{
  573. X    register int i;
  574. X    struct anim_object *ap;
  575. X    int changed;
  576. X
  577. X    for (changed = 1; changed; /* nothing */ )
  578. X    {
  579. X    changed = 0;
  580. X    NullSet (anim_buffer, sizeof (anim_buffer));
  581. X    SpaceFlood (anim_buffer, SCREENWIDTH);
  582. X
  583. X    for (i = 0; aobjects[i].object && (i < MAX_ANIM_OBJS - 1); i++)
  584. X    {
  585. X        ap = &aobjects[i];
  586. X
  587. X        LimCopy (anim_buffer, ap -> object, ap -> location);
  588. X        if (ap -> location > ap -> destination)
  589. X        {
  590. X        ap -> location--;
  591. X        changed++;
  592. X        } else if (ap -> location < ap -> destination)
  593. X        {
  594. X        ap -> location++;
  595. X        changed++;
  596. X        }
  597. X    }
  598. X    /* anim_buffer is dealt with in Update() for masking reasons */
  599. X    UpdateCR ();
  600. X    }
  601. X}
  602. END_OF_FILE
  603. if test 1621 -ne `wc -c <'anim.c'`; then
  604.     echo shar: \"'anim.c'\" unpacked with wrong size!
  605. fi
  606. # end of 'anim.c'
  607. fi
  608. if test -f 'asp.c' -a "${1}" != "-c" ; then 
  609.   echo shar: Will not clobber existing file \"'asp.c'\"
  610. else
  611. echo shar: Extracting \"'asp.c'\" \(6734 characters\)
  612. sed "s/^X//" >'asp.c' <<'END_OF_FILE'
  613. X/*
  614. X * This code is copyright ADE Muffett, September 1991, and is distributed as
  615. X * part of the ASP .plan description language compiler.  This code is freely
  616. X * redistributable as long as this copyright notice remains intact. No
  617. X * responsibility is assumed by the author for any situation which arises
  618. X * from the use of this code, including insanity, late nights, or disk
  619. X * storage problems.
  620. X */
  621. X
  622. X/* Unix is a Bellmark of Lab Tradeoratories */
  623. X
  624. X#include "asp.h"
  625. X#undef TESTING
  626. X
  627. X/* GLOBAL DATA */
  628. Xint speed;
  629. Xint smooth;
  630. Xchar stdline[SCREENWIDTH + 1];
  631. Xchar anim_buffer[SCREENWIDTH + 1];
  632. Xchar foreground[SCREENWIDTH + 1];
  633. Xchar background[SCREENWIDTH + 1];
  634. Xstruct anim_object aobjects[MAX_ANIM_OBJS];
  635. X/* END OF GLOBAL DATA */
  636. X
  637. Xstruct command_structure
  638. X{
  639. X    char *codeword;
  640. X    void (*fn) ();
  641. X    char has_args;
  642. X};
  643. X
  644. Xstruct command_call
  645. X{
  646. X    int c_index;
  647. X    char *invocation;
  648. X};
  649. X
  650. Xstatic FILE *fp;
  651. Xstatic char version[] = "asp3.2(c)aem@aber";
  652. Xstatic struct command_call command_calls[COMMAND_COUNT];
  653. Xstatic struct command_structure command_name[COMMAND_COUNT];
  654. X
  655. Xvoid
  656. XSmooth (command)
  657. X    char *command;
  658. X{
  659. X    sscanf (command, "%*s %d", &smooth);
  660. X}
  661. X
  662. Xvoid
  663. XSpeed (command)
  664. X    char *command;
  665. X{
  666. X    sscanf (command, "%*s %d", &speed);
  667. X}
  668. X
  669. Xvoid
  670. XFlush ()
  671. X{
  672. X    command_calls[0].c_index = 0;
  673. X}
  674. X
  675. Xchar *
  676. XBuildArgs (commstring, name_index)
  677. X    char *commstring;
  678. X    int name_index;
  679. X{
  680. X    char cbuf[255];
  681. X
  682. X    if (!strcmp (command_name[name_index].codeword, ".object") ||
  683. X    !strcmp (command_name[name_index].codeword, ".speed") ||
  684. X    !strcmp (command_name[name_index].codeword, ".smooth"))
  685. X    {
  686. X    return (CopyString (commstring));
  687. X    }
  688. X    if (!strcmp (command_name[name_index].codeword, ".foreground"))
  689. X    {
  690. X    fgets (cbuf, 255, fp);
  691. X    NullSet (foreground, sizeof (foreground));
  692. X    strncpy (foreground, cbuf, SCREENWIDTH);
  693. X    return ((char *) NULL);
  694. X    }
  695. X    if (!strcmp (command_name[name_index].codeword, ".background"))
  696. X    {
  697. X    fgets (cbuf, 255, fp);
  698. X    NullSet (background, sizeof (background));
  699. X    strncpy (background, cbuf, SCREENWIDTH);
  700. X    return ((char *) NULL);
  701. X    }
  702. X    fprintf (stderr, "%s: NYI\n", commstring);
  703. X    return ((char *) 0);
  704. X}
  705. X
  706. Xvoid
  707. XNewFunction (cw, fn, args)
  708. X    char *cw;
  709. X    void (*fn) ();
  710. X    char args;
  711. X{
  712. X    static int command_count = 1;    /* load commands from 1st element */
  713. X
  714. X    command_name[command_count].codeword = cw;
  715. X    command_name[command_count].fn = fn;
  716. X    command_name[command_count].has_args = args;
  717. X    command_count++;
  718. X    command_name[command_count].codeword = NULL;
  719. X}
  720. X
  721. Xvoid
  722. XParseCommands (cstring)
  723. X    register char *cstring;
  724. X{
  725. X    int i;
  726. X    int comm_number;
  727. X    char *ptr;
  728. X    int get_next_line;
  729. X    char otherbuffer[255];
  730. X    static char dot = '.';
  731. X
  732. X    comm_number = 0;
  733. X    command_calls[comm_number].c_index = 0;
  734. X
  735. X  start_parsing:
  736. X    i = strlen (cstring) - 1;
  737. X    if (cstring[i] == '\\')
  738. X    {
  739. X    get_next_line = 1;
  740. X    cstring[i] = '\0';
  741. X    } else
  742. X    {
  743. X    get_next_line = 0;
  744. X    }
  745. X
  746. X    for (ptr = (char *) strchr (cstring, dot);
  747. X     ptr;
  748. X     ptr = (char *) strchr (ptr, dot))
  749. X    {
  750. X    if (!*ptr)        /* no more commands */
  751. X    {
  752. X        break;
  753. X    }
  754. X    for (i = 1; command_name[i].codeword; i++)
  755. X    {
  756. X        if (!strncmp (ptr, command_name[i].codeword,
  757. X              strlen (command_name[i].codeword)))
  758. X        {
  759. X        command_calls[comm_number].c_index = i;
  760. X
  761. X        if (command_name[i].has_args != 'Y')
  762. X        {
  763. X            command_calls[comm_number].invocation = (char *) 0;
  764. X            comm_number++;
  765. X            break;
  766. X        } else
  767. X        {
  768. X            command_calls[comm_number].invocation = BuildArgs (ptr, i);
  769. X            comm_number++;
  770. X            break;
  771. X        }
  772. X        }
  773. X    }
  774. X
  775. X    if (!command_name[i].codeword)
  776. X    {
  777. X        fprintf (stderr, "Error: unknown command '%s'\n", ptr);
  778. X    }
  779. X    ptr++;            /* make this neater */
  780. X    }
  781. X    if (get_next_line)
  782. X    {
  783. X    fgets (otherbuffer, 255, fp);
  784. X    Trim (otherbuffer);
  785. X    cstring = otherbuffer;
  786. X    goto start_parsing;
  787. X    }
  788. X    command_calls[comm_number++].c_index = 0;
  789. X}
  790. X
  791. Xvoid
  792. XExecuteCommandsOn (dstring)
  793. X    register char *dstring;
  794. X{
  795. X    register int i;
  796. X    register int j;
  797. X
  798. X    for (i = 0; command_calls[i].c_index; i++)
  799. X    {
  800. X    j = command_calls[i].c_index;
  801. X#ifdef TESTING
  802. X    printf ("executing '%s' as '%s' on \n'%s'\n", command_name[j].codeword,
  803. X        command_calls[i].invocation, dstring);
  804. X#else
  805. X    (*command_name[j].fn) (command_calls[i].invocation, dstring);
  806. X#endif
  807. X    }
  808. X}
  809. X
  810. Xint
  811. Xmain (argc, argv)
  812. X    int argc;
  813. X    char *argv[];
  814. X{
  815. X    char command_buffer[255];
  816. X    char line_buffer[255];
  817. X    register char *ptr;
  818. X    register int i;
  819. X    static char dot = '.';
  820. X
  821. X    srand (time (0));
  822. X
  823. X    NewFunction (".wspatter", WordSpatter, 'N');
  824. X    NewFunction (".wipe", Wipe, 'N');
  825. X    NewFunction (".tshow", TShow, 'N');
  826. X    NewFunction (".speed", Speed, 'Y');
  827. X    NewFunction (".spatter", Spatter, 'N');
  828. X    NewFunction (".smooth", Smooth, 'Y');
  829. X    NewFunction (".show", Show, 'N');
  830. X    NewFunction (".scrollof", ScrollOffForward, 'N');
  831. X    NewFunction (".scrollob", ScrollOffBackward, 'N');
  832. X    NewFunction (".scrollf", ScrollForward, 'N');
  833. X    NewFunction (".scrollb", ScrollBackward, 'N');
  834. X    NewFunction (".reset", ResetAnim, 'N');
  835. X    NewFunction (".p", Pause, 'N');
  836. X    NewFunction (".object", AddObject, 'Y');
  837. X    NewFunction (".noop", Noop, 'N');
  838. X    NewFunction (".nl", LineFeed, 'N');
  839. X    NewFunction (".macro", NULL, 'N');
  840. X    NewFunction (".letter3", Letter3, 'N');
  841. X    NewFunction (".letter2", Letter2, 'N');
  842. X    NewFunction (".letter1", Letter1, 'N');
  843. X    NewFunction (".laymte", LayMiddleToEnds, 'N');
  844. X    NewFunction (".layf", LayForward, 'N');
  845. X    NewFunction (".layetm", LayEndsToMiddle, 'N');
  846. X    NewFunction (".layb", LayBackward, 'N');
  847. X    NewFunction (".foreground", Noop, 'Y');
  848. X    NewFunction (".flush", Flush, 'N');
  849. X    NewFunction (".flash", Flash, 'N');
  850. X    NewFunction (".fade", Fade, 'N');
  851. X    NewFunction (".clear", Clear, 'N');
  852. X    NewFunction (".background", Noop, 'Y');
  853. X    NewFunction (".anim", Animate, 'N');
  854. X
  855. X    if (isatty (fileno (stdin)))
  856. X    {
  857. X    if (argc == 1)
  858. X    {
  859. X        fprintf (stderr, "Usage:\t%s <filename>\n", argv[0]);
  860. X        exit (1);
  861. X    }
  862. X    fp = fopen (argv[1], "r");
  863. X    if (!fp)
  864. X    {
  865. X        perror (argv[1]);
  866. X        exit (1);
  867. X    }
  868. X    } else
  869. X    {
  870. X    fp = stdin;
  871. X    }
  872. X
  873. X    for (*line_buffer = '\0'; !feof (fp); *line_buffer = '\0')
  874. X    {
  875. X    fgets (line_buffer, 255, fp);
  876. X
  877. X    if (!*line_buffer || *line_buffer == '\n')    /* allow blank lines */
  878. X    {
  879. X        if (!command_calls[0].c_index)
  880. X        {
  881. X        putchar ('\n');
  882. X        }
  883. X        continue;
  884. X    }
  885. X    Trim (line_buffer);    /* trim w/s */
  886. X
  887. X    if (*line_buffer == dot)
  888. X    {
  889. X        ParseCommands (line_buffer);
  890. X        continue;
  891. X    }
  892. X    if (!command_calls[0].c_index)    /* don't faff around... */
  893. X    {
  894. X        printf ("%s\n", line_buffer);
  895. X        continue;
  896. X    }
  897. X    ExecuteCommandsOn (line_buffer);
  898. X    }
  899. X    fclose (fp);
  900. X
  901. X    printf ("\n\r%s\r", version);
  902. X    i = strlen (version);
  903. X    while (i--)
  904. X    {
  905. X    putchar (' ');
  906. X    }
  907. X    putchar ('\r');
  908. X
  909. X    return (0);
  910. X}
  911. END_OF_FILE
  912. if test 6734 -ne `wc -c <'asp.c'`; then
  913.     echo shar: \"'asp.c'\" unpacked with wrong size!
  914. fi
  915. # end of 'asp.c'
  916. fi
  917. if test -f 'asp.h' -a "${1}" != "-c" ; then 
  918.   echo shar: Will not clobber existing file \"'asp.h'\"
  919. else
  920. echo shar: Extracting \"'asp.h'\" \(2427 characters\)
  921. sed "s/^X//" >'asp.h' <<'END_OF_FILE'
  922. X/*
  923. X * This code is copyright ADE Muffett, September 1991, and is distributed as
  924. X * part of the ASP .plan description language compiler.  This code is freely
  925. X * redistributable as long as this copyright notice remains intact. No
  926. X * responsibility is assumed by the author for any situation which arises
  927. X * from the use of this code, including insanity, late nights, or disk
  928. X * storage problems.
  929. X */
  930. X
  931. X#include <stdio.h>
  932. X
  933. X#define USE_INDEX        /* use index instead of strchr() */
  934. X#define SCREENWIDTH    79    /* colourbook screws you up */
  935. X#define COMMAND_COUNT    1024    /* max number of commands in a rule */
  936. X#define LOOP_COUNT     2048    /* several things, eg: delay loop */
  937. X#define MAX_ANIM_OBJS    512    /* maximum number of objects in an anim */
  938. X#define DUMMY_RETURNS    8    /* speed 0 = 0; 1 = 64, 2 = 128... */
  939. X#define NUM_FLASH    16    /* number of flashes for 1 ".flash" */
  940. X
  941. X/* strdup() if you have it... */
  942. X#define CopyString(xxx)    ((char *)strcpy((char *)malloc(strlen(xxx)+1), xxx))
  943. X
  944. X#ifdef USE_INDEX
  945. X#define strchr(a,b)    index(a,b)
  946. X#endif
  947. X
  948. Xstruct anim_object
  949. X{
  950. X    char *object;
  951. X    int location;
  952. X    int destination;
  953. X};
  954. X
  955. Xextern char *BuildArgs ();
  956. Xextern char *Memcpy ();
  957. Xextern char anim_buffer[SCREENWIDTH + 1];
  958. Xextern char background[SCREENWIDTH + 1];
  959. Xextern char foreground[SCREENWIDTH + 1];
  960. Xextern char stdline[SCREENWIDTH + 1];
  961. Xextern int Update ();
  962. Xextern int smooth;
  963. Xextern int speed;
  964. Xextern struct anim_object aobjects[MAX_ANIM_OBJS];
  965. Xextern void AddObject ();
  966. Xextern void Animate ();
  967. Xextern void CReturn ();
  968. Xextern void Clear ();
  969. Xextern void ExecuteCommandsOn ();
  970. Xextern void Fade ();
  971. Xextern void Flash ();
  972. Xextern void Flush ();
  973. Xextern void LayBackward ();
  974. Xextern void LayEndsToMiddle ();
  975. Xextern void LayForward ();
  976. Xextern void LayMiddleToEnds ();
  977. Xextern void Letter1 ();
  978. Xextern void Letter2 ();
  979. Xextern void Letter3 ();
  980. Xextern void LimCopy ();
  981. Xextern void LineFeed ();
  982. Xextern void NewFunction ();
  983. Xextern void Noop ();
  984. Xextern void NullSet ();
  985. Xextern void Overlay ();
  986. Xextern void ParseCommands ();
  987. Xextern void Pause ();
  988. Xextern void ResetAnim ();
  989. Xextern void ScrollBackward ();
  990. Xextern void ScrollForward ();
  991. Xextern void ScrollOffBackward ();
  992. Xextern void ScrollOffForward ();
  993. Xextern void Show ();
  994. Xextern void Smooth ();
  995. Xextern void SpaceFlood ();
  996. Xextern void Spatter ();
  997. Xextern void Speed ();
  998. Xextern void TShow ();
  999. Xextern void TransparentOverlay ();
  1000. Xextern void Trim ();
  1001. Xextern void UpdateCR ();
  1002. Xextern void Wipe ();
  1003. Xextern void WordSpatter ();
  1004. END_OF_FILE
  1005. if test 2427 -ne `wc -c <'asp.h'`; then
  1006.     echo shar: \"'asp.h'\" unpacked with wrong size!
  1007. fi
  1008. # end of 'asp.h'
  1009. fi
  1010. if test -f 'copy.c' -a "${1}" != "-c" ; then 
  1011.   echo shar: Will not clobber existing file \"'copy.c'\"
  1012. else
  1013. echo shar: Extracting \"'copy.c'\" \(1840 characters\)
  1014. sed "s/^X//" >'copy.c' <<'END_OF_FILE'
  1015. X/*
  1016. X * This code is copyright ADE Muffett, September 1991, and is distributed as
  1017. X * part of the ASP .plan description language compiler.  This code is freely
  1018. X * redistributable as long as this copyright notice remains intact. No
  1019. X * responsibility is assumed by the author for any situation which arises
  1020. X * from the use of this code, including insanity, late nights, or disk
  1021. X * storage problems.
  1022. X */
  1023. X
  1024. X#include "asp.h"
  1025. X
  1026. X/* alas, for ANSI... */
  1027. Xchar *
  1028. XMemcpy (to2, from, num)
  1029. X    char *to2;
  1030. X    register char *from;
  1031. X    register int num;
  1032. X{
  1033. X    register char *to = to2;
  1034. X
  1035. X    while (num--)
  1036. X    {
  1037. X    *(to++) = *(from++);
  1038. X    }
  1039. X    return (to2);
  1040. X}
  1041. X/* Set a buffer to be full of nulls */
  1042. Xvoid
  1043. XNullSet (string, num)
  1044. X    register char *string;
  1045. X    register int num;
  1046. X{
  1047. X    while (num--)
  1048. X    {
  1049. X    *(string++) = '\0';
  1050. X    }
  1051. X}
  1052. X/* Set all nulls in a buffer to be whitespace */
  1053. Xvoid
  1054. XSpaceFlood (string, num)
  1055. X    register char *string;
  1056. X    register int num;
  1057. X{
  1058. X    while (num--)
  1059. X    {
  1060. X    if (!*string)
  1061. X    {
  1062. X        *string = ' ';
  1063. X    }
  1064. X    string++;
  1065. X    }
  1066. X}
  1067. X/* copy source to destination without adding trailing null */
  1068. Xvoid
  1069. XOverlay (destination, source)
  1070. X    register char *destination;
  1071. X    register char *source;
  1072. X{
  1073. X    while (*source)
  1074. X    {
  1075. X    *(destination++) = *(source++);
  1076. X    }
  1077. X}
  1078. X/* copy source to destination without adding trailing null, except whitespace */
  1079. Xvoid
  1080. XTransparentOverlay (destination, source)
  1081. X    register char *destination;
  1082. X    register char *source;
  1083. X{
  1084. X    while (*source)
  1085. X    {
  1086. X    if (*source != ' ')
  1087. X    {
  1088. X        *destination = *source;
  1089. X    }
  1090. X    source++;
  1091. X    destination++;
  1092. X    }
  1093. X}
  1094. X/* copy into a bounded buffer */
  1095. Xvoid
  1096. XLimCopy (to, from, start)
  1097. X    register char *to;
  1098. X    register char *from;
  1099. X    register int start;
  1100. X{
  1101. X    while (*from)
  1102. X    {
  1103. X    if (start >= 0 && start < SCREENWIDTH)
  1104. X    {
  1105. X        to[start] = *from;
  1106. X    }
  1107. X    from++;
  1108. X    start++;
  1109. X    }
  1110. X}
  1111. X/* END OF COPY PRIMITIVES */
  1112. END_OF_FILE
  1113. if test 1840 -ne `wc -c <'copy.c'`; then
  1114.     echo shar: \"'copy.c'\" unpacked with wrong size!
  1115. fi
  1116. # end of 'copy.c'
  1117. fi
  1118. if test -f 'demo1.asp' -a "${1}" != "-c" ; then 
  1119.   echo shar: Will not clobber existing file \"'demo1.asp'\"
  1120. else
  1121. echo shar: Extracting \"'demo1.asp'\" \(132 characters\)
  1122. sed "s/^X//" >'demo1.asp' <<'END_OF_FILE'
  1123. X.smooth 1 .speed 25
  1124. X--
  1125. X.show .p .p
  1126. X                    Beware the M25 - heavy lorries !
  1127. X.object oo-oP -15 80 .anim .resetanim .p
  1128. X--
  1129. END_OF_FILE
  1130. if test 132 -ne `wc -c <'demo1.asp'`; then
  1131.     echo shar: \"'demo1.asp'\" unpacked with wrong size!
  1132. fi
  1133. # end of 'demo1.asp'
  1134. fi
  1135. if test -f 'demo2.asp' -a "${1}" != "-c" ; then 
  1136.   echo shar: Will not clobber existing file \"'demo2.asp'\"
  1137. else
  1138. echo shar: Extracting \"'demo2.asp'\" \(3930 characters\)
  1139. sed "s/^X//" >'demo2.asp' <<'END_OF_FILE'
  1140. X.smooth 1
  1141. X
  1142. X.nl .nl .nl .p .show .p
  1143. X******************* scrolling enterprises proudly presents:- *******************
  1144. X
  1145. X.scrollob
  1146. X--------------------------------------------------------------------------------
  1147. X
  1148. X.show .p .p .fade
  1149. X----------------------(A Roadrunner>>>++>> Production)--------------------------
  1150. X
  1151. X.spatter .p .p .fade
  1152. X----------------------------- DAVID ATTENBOROUGH'S -----------------------------
  1153. X
  1154. X.tshow .p
  1155. X                                 LIFE
  1156. X                                      ON
  1157. X                                         UNIX
  1158. X
  1159. X.clear .scrollf .p .fade .p
  1160. XHello and good evening. 8)
  1161. X
  1162. X.show .p .p
  1163. XTonight we are going to examine the sex life of that rare and elusive creature,
  1164. XThe Andalusian Video Snail.
  1165. X
  1166. X.object \@_ 85 40 .anim .resetanim .p
  1167. X--
  1168. X.object \@_ 40 40 .object ? 38 38 .anim .resetanim .p
  1169. X--
  1170. X.object _@_ 40 40 .anim .resetanim
  1171. X--
  1172. X.object _@/ 40 85 .anim .resetanim
  1173. X--
  1174. X
  1175. X.fade
  1176. XThe Andalusian Video Snail.
  1177. X
  1178. X.show .p .p
  1179. X
  1180. XYes, this small and unobtrusive gastropod, which has never before been studied
  1181. Xin it's native habitat, has confused biologists for years; feeding as it does
  1182. X
  1183. X.show .p .object _@/ -5 80 .anim .resetanim .p
  1184. Xupon the core dumps and executable images to be found on large UNIX mainframes.
  1185. X
  1186. X.clear
  1187. X--
  1188. X
  1189. X.show .p .p
  1190. XIt derives nourishment from bad blocks and thrives on operating systems where
  1191. Xkernel crashes are frequent.  There is some evidence to suggest that they are
  1192. Xthe original computer 'bugs', but this would then be a misnomer, because they
  1193. Xare, of course, actually snails.
  1194. X
  1195. X.object \@_ 80 34 .anim .resetanim .p
  1196. X--
  1197. X.object _@_ 34 34 .anim .resetanim .p
  1198. X--
  1199. X.object _!_ 34 34 .anim .resetanim .p
  1200. X--
  1201. X.object _@_ 34 34 .anim .resetanim .p
  1202. X--
  1203. X.object _@/ 34 80 .anim .resetanim .p
  1204. X--
  1205. X
  1206. X.clear
  1207. X--
  1208. X
  1209. X.show .p .p
  1210. XNo-one has yet captured one of these creatures, for whenever a snail happens
  1211. Xonto the screen of a VDU, it immediately vanishes once the terminal has been
  1212. Xdisconnected from the network.  After searching the length and breadth of the
  1213. Xnetwork, we are now able to bring you pictures of the extraordinary courtship
  1214. Xand mating rituals of these snails...
  1215. X
  1216. X.fade .p .clear
  1217. Xand mating rituals of these snails...
  1218. X
  1219. X.show .p .p .clear .nl
  1220. X                            (photographs courtesy of the digital corporation)
  1221. X.show .nl
  1222. X            ___/--~                            ~~~\____
  1223. X                    _/\/                                             \_
  1224. X      /\          _/                                                  ||\_
  1225. X     /   \/\_    /                                                       ~ \_
  1226. X
  1227. X.background
  1228. X\___/        \__/                                                            \_
  1229. X
  1230. X.tshow .p .wipe
  1231. X                                   (ANDALUSIA)
  1232. X
  1233. X.object _@/ -20 37 .anim .p
  1234. X--
  1235. X
  1236. X.object \@_ 100 62 .anim
  1237. X--
  1238. X
  1239. X.object ? 60 60 .anim .p .resetanim
  1240. X--
  1241. X
  1242. X.object _@/ 37 37 \
  1243. X.object \@_ 62 62 .anim .p
  1244. X--
  1245. X
  1246. X.object ! 60 60 .anim .p .resetanim
  1247. X--
  1248. X
  1249. X.object _@/ 37 37 \
  1250. X.object \@_ 60 40 \
  1251. X.anim .p .resetanim
  1252. X--
  1253. X
  1254. X.show .p
  1255. X               (let us draw a delicate veil over these proceedings)
  1256. X
  1257. X.show .p .p
  1258. X                              {}{}{}CENSORED{}{}{}
  1259. X
  1260. X.object _@/ 40 60 \
  1261. X.object \@_ 40 -5 \
  1262. X.object {}{}{}CENSORED{}{}{} 30 30 \
  1263. X.anim .p .resetanim
  1264. X--
  1265. X
  1266. X.object {}{}{}CENSORED{}{}{} 30 30 \
  1267. X.object _@_ 60 60 \
  1268. X.anim .p
  1269. X--
  1270. X
  1271. X.object <ZZZzzz...> 63 63 \
  1272. X.anim .p .resetanim .clear
  1273. X--
  1274. X
  1275. X.laymte .p .wipe
  1276. X                                -  THE END -
  1277. X
  1278. X.background
  1279. X
  1280. X.wipe .nl .nl
  1281. X--
  1282. X
  1283. X.layetm .p .clear
  1284. X             This educational program has been brought to you by:-
  1285. X
  1286. X.show .p .wipe
  1287. X                           The numbers 4 and 17
  1288. X                               The letter 'Q'
  1289. X                                and also...
  1290. X.spatter .p .nl .wipe .p
  1291. X                             Alec D.E. Muffett
  1292. X                             Roadrunner>>>++>>
  1293. X                              (using asp 3.2)
  1294. X
  1295. X.scrollf .p .wipe
  1296. X    [Next week we investigate the habits of the Lothian Software Wombat.]
  1297. X
  1298. X.nl .nl
  1299. X--
  1300. END_OF_FILE
  1301. if test 3930 -ne `wc -c <'demo2.asp'`; then
  1302.     echo shar: \"'demo2.asp'\" unpacked with wrong size!
  1303. fi
  1304. # end of 'demo2.asp'
  1305. fi
  1306. if test -f 'demo3.asp' -a "${1}" != "-c" ; then 
  1307.   echo shar: Will not clobber existing file \"'demo3.asp'\"
  1308. else
  1309. echo shar: Extracting \"'demo3.asp'\" \(4739 characters\)
  1310. sed "s/^X//" >'demo3.asp' <<'END_OF_FILE'
  1311. X.smooth 1 .p
  1312. X--
  1313. X
  1314. X.wspatter .p .p .p .fade
  1315. X  (C) ADE Muffett, UCW Aberystwyth, 1991. "aem@aber.ac.uk" "...!ukc!aber!aem"
  1316. X
  1317. X.spatter .p .p .fade .p
  1318. X                        A Roadrunner>>>++>> production
  1319. X
  1320. X.show .p .p .clear
  1321. X                                  Hello there.
  1322. X               I bet you're wondering what I've been up to of late.
  1323. X                      On the other hand maybe you haven't.
  1324. X          Perhaps you don't know about scrolling ".plan" files at all ?
  1325. X
  1326. X.p .p
  1327. X--
  1328. X
  1329. X.show .p .p .wipe
  1330. X You see (for those newcomers amongst you), a long time ago, two undergraduates
  1331. X                   here in Aberystwyth decided to have a 'war'.
  1332. X
  1333. X.p .p
  1334. X--
  1335. X
  1336. X.show .p .p .clear
  1337. X              They were (are) Alun Jones "alj8" and Kev Brooks "kkb9".
  1338. X
  1339. X.p .p
  1340. X--
  1341. X
  1342. X.show .p .p .clear
  1343. X          The war was over who could produce the 'prettiest' ".plan" file.
  1344. X
  1345. X.p .p
  1346. X--
  1347. X
  1348. X.show .p .p .wipe
  1349. X     They fought tooth and nail, with many people watching on the sidelines.
  1350. X Letters scrolled on and off the screen, flashed at you, it was quite amusing.
  1351. X
  1352. X.p .p
  1353. X--
  1354. X
  1355. X.scrollob .p .p
  1356. X    But then one day, I saw one effort (Kev's) that was really appalling:
  1357. X   A huge data file that flashed, flickered and grunged its way across the
  1358. X     screen, and I thought to myself :- "I can do much better than that!"
  1359. X
  1360. X.p .p
  1361. X--
  1362. X
  1363. X.show .p .p .clear
  1364. XI think that in retrospect I was right.  8)
  1365. XI sat down, and I wrote "ASP" :-
  1366. X
  1367. X.show .nl .p .p .wipe
  1368. XAlec's Scrolling Program: a description language for plan files
  1369. X                - written in fairly portable C
  1370. X                - with a nice simple syntax
  1371. X                - and above all, pleasant and easy to use.
  1372. X
  1373. X.nl .p .p
  1374. X--
  1375. X
  1376. X.scrollb .p .p .clear
  1377. XSo - What can you do with ASP ? (I hear you scream)
  1378. X
  1379. X.show .p .p
  1380. X(apart from flashing messages like this on and off of the screen)
  1381. X
  1382. X.speed 20 .flash
  1383. X            flashing
  1384. X
  1385. X.speed 0 .clear .p .p
  1386. X--
  1387. X
  1388. X.scrollf .p .p
  1389. XYou can scroll a piece of text onto the screen line, either forwards...
  1390. X
  1391. X.scrollb .p .p
  1392. X ...or backwards onto the screen (just like this !)
  1393. X
  1394. X.scrollof .p .p
  1395. XOr what you have on the screen already can be scrolled off to the right ----->
  1396. X
  1397. X.scrollob .p .p .wipe
  1398. X<----------------- and ditto off to the left, as you might expect.
  1399. X
  1400. X.spatter .p .p .wipe
  1401. X               You can spatter bits of text onto the screen
  1402. X
  1403. X.show .p .p .fade .p
  1404. X               and then just let them fade into nothingness....
  1405. X
  1406. X.layf .p .p .wipe
  1407. X       Messages can be laid down letter by letter, from left to right;
  1408. X
  1409. X.layb .p .p .wipe
  1410. X             ...and of course, ditto for messages right to left.
  1411. X
  1412. X.laymte .p .p .wipe
  1413. X Then there is laying messages down from the middle to the ends of the screen
  1414. X
  1415. X.layetm .p .p .wipe
  1416. X                - and vice versa for messages, ends to middle.
  1417. X
  1418. X.laymte
  1419. X         really build up some                                         these...
  1420. X
  1421. X.layetm
  1422. X You can really build up some quite complex
  1423. X
  1424. X.laymte .p .p .fade .wipe
  1425. X You can really build up some quite complex special effects with only these...
  1426. X
  1427. X.letter1
  1428. Xbut thats nothing compared to what you can do with the special text functions.
  1429. XBUT THATS NOTHING COMPARED TO WHAT YOU CAN DO WITH THE SPECIAL TEXT FUNCTIONS.
  1430. XBut thats nothing compared to what you can do with the special text functions.
  1431. X
  1432. X.wipe .p .p
  1433. X--
  1434. X
  1435. X.letter2
  1436. X       ESPECIALLY when YOU employ THE RANDOM-character-SEARCH macros.
  1437. X
  1438. X.letter1
  1439. X       especially WHEN you EMPLOY the random-CHARACTER-search MACROS.
  1440. X       esPECIALLY when yoU emPLOY the random-chARACTER-sEARCH macros.
  1441. X       ESPEcially wHEN YOu EMPloy THE RANDOM-character-SEarch macROS.
  1442. X       especiALLY whEN you EMPLoy the ranDOM-CHARacter-seaRCH macROS.
  1443. X       Especially when you employ the random-character-search macros.
  1444. X
  1445. X.clear .p .p
  1446. X--
  1447. X
  1448. X.show .p .p .clear
  1449. X        But the thing that really "made it" in my mind, was animation.
  1450. X                      Foregrounds and backgrounds.
  1451. X                           The whole kaboodle.
  1452. X
  1453. X.p .p .show .p .p
  1454. XAnd thus was born the Andalusian Video Snail:
  1455. X
  1456. X.object \@_ 100 50 .anim .resetanim .p .p
  1457. X--
  1458. X
  1459. X.object _@_ 50 50 .anim .resetanim .p
  1460. X--
  1461. X
  1462. X.object _@/ 50 100 .anim .resetanim .p .p
  1463. X--
  1464. X
  1465. X.tshow .p .p .clear
  1466. X                                              And everyone copied it... Foo !
  1467. X
  1468. X.show .p .p .wipe
  1469. X                                        8)
  1470. X                  Oh well. Back to the hack. See you again soon.
  1471. X   ps: a copy of the asp source code for this plan can be found in the file
  1472. X
  1473. X.show \
  1474. X.object ----> 0 74 \
  1475. X.object <---- 74 0 \
  1476. X.anim .resetanim \
  1477. X.object ----> 0 74 \
  1478. X.object <---- 74 0 \
  1479. X.anim .resetanim \
  1480. X.show
  1481. X                 "demo3.asp" in the standard asp distribution.
  1482. X
  1483. X.nl .show .p
  1484. X                                     Bye Now...
  1485. X                                Alec D.E. Muffett
  1486. X                                     (c) 1991
  1487. END_OF_FILE
  1488. if test 4739 -ne `wc -c <'demo3.asp'`; then
  1489.     echo shar: \"'demo3.asp'\" unpacked with wrong size!
  1490. fi
  1491. # end of 'demo3.asp'
  1492. fi
  1493. if test -f 'demo4.asp' -a "${1}" != "-c" ; then 
  1494.   echo shar: Will not clobber existing file \"'demo4.asp'\"
  1495. else
  1496. echo shar: Extracting \"'demo4.asp'\" \(3434 characters\)
  1497. sed "s/^X//" >'demo4.asp' <<'END_OF_FILE'
  1498. X.clear .p .scrollf .p .p
  1499. X                                    Hello.
  1500. X
  1501. X.scrollob .p .p
  1502. X                                 I'm sad.  8(
  1503. X
  1504. X.scrollof .p .p
  1505. X                           Do you know why I'm sad ?
  1506. X
  1507. X.scrollob .p .p
  1508. X                     No, you wouldn't. Why would you care ?
  1509. X
  1510. X.scrollof .p .p
  1511. X                       Do you want to know why I'm sad ?
  1512. X
  1513. X.scrollob .p .p
  1514. X                  No, you still wouldn't. Why would you care ?
  1515. X
  1516. X.scrollof .object \@_ 85 0 .anim .resetanim
  1517. X                Is it because my Andalusian Video snail escaped ?
  1518. X
  1519. X.scrollob .p .p
  1520. X                           Look ! There it goes now !!!
  1521. X
  1522. X.scrollof .p .p
  1523. X                                    No...
  1524. X
  1525. X.scrollob .p .p .fade .p
  1526. X                                It's not that.
  1527. X
  1528. X.spatter .p .p .fade
  1529. X       Is it because I've been listening to too many Joy Division tracks ?
  1530. X                              I don't think so...
  1531. X           I haven't been listening to ANY Joy Division Tracks...
  1532. X
  1533. X.object _@/ -5 80 .anim .resetanim
  1534. X--
  1535. X
  1536. X.wspatter .p .p .wipe .p
  1537. X                             There it goes again.
  1538. X                                Bloody snail.
  1539. X                     I'm not really sure *WHY* I'm sad.
  1540. X                                  after all...
  1541. X
  1542. X.wspatter .p .p .fade .p
  1543. X  there aren't many screen drivers that can fade messages into nothingness...
  1544. X
  1545. X.spatter .p .p .clear .p
  1546. Xor others which magic them up from nothingness, only to wipe them into oblivion
  1547. X
  1548. X.scrollf .p .p
  1549. X                        Scroll them in from the left
  1550. X
  1551. X.scrollob .p .p
  1552. X                       .thgir eht morf ni meht llorcS
  1553. X.wipe
  1554. X--
  1555. X
  1556. X.speed 4 .wspatter .wipe .wspatter .wipe .wspatter .wipe .wspatter .wipe
  1557. X         Flashing messages seem to be very much in vogue at the moment.
  1558. X         Flashing messages seem to be very much in vogue at the moment.
  1559. X         Flashing messages seem to be very much in vogue at the moment.
  1560. X         Flashing messages seem to be very much in vogue at the moment.
  1561. X
  1562. X.speed 15 .show
  1563. X       I don't like this style of flashing very much to tell the truth...
  1564. X
  1565. X.flash .wipe
  1566. X                    this          flashing
  1567. X
  1568. X.speed 15 .p .wspatter .p
  1569. X  Words can just be laid down in any old order you like, no problems at all...
  1570. X
  1571. X.speed 0 .wipe
  1572. X--
  1573. X
  1574. X.layetm
  1575. X                           whether it is worth it
  1576. X                                                  all, being a microprocessor.
  1577. X Sometimes I really wonder
  1578. X
  1579. X.wipe .p
  1580. X--
  1581. X
  1582. X.laymte
  1583. X              should have been a
  1584. X                                                        like my mother wanted.
  1585. X Or whether I
  1586. X                                 Scientific Calculator,
  1587. X
  1588. X.wipe .p
  1589. X--
  1590. X
  1591. X.speed 0 .p .clear .p .show .p
  1592. X                    I ALWAYS WANTED TO BE A FRUIT MACHINE !!!!
  1593. X
  1594. X.wipe .layb .p .fade
  1595. X                              I wanted the fame !
  1596. X.wipe .layf .p .fade
  1597. X                           I wanted the high life !
  1598. X.wipe .layb .p .fade
  1599. X                               But most of all....
  1600. X
  1601. X.show .p .p .fade
  1602. X                              I WANTED THE MONEY !
  1603. X
  1604. X.speed 20 .spatter .p .wipe
  1605. X                                    Oh well.
  1606. X.speed 2 \
  1607. X.object his -30 40 \
  1608. X.object dreams, -50 44 \
  1609. X.object computer -15 22 \
  1610. X.object he -2 58 \
  1611. X.object ? -250 61 \
  1612. X.object can 89 31 \
  1613. X.object have 100 35 \
  1614. X.object can 111 52 \
  1615. X.object A 150 20 \
  1616. X.object 't 200 55 \
  1617. X.anim .resetanim .p .p .p .nl
  1618. X--
  1619. X
  1620. X.show .p .p .nl .wipe
  1621. X                               Alec D.E. Muffett
  1622. X                                (using asp 3.2)
  1623. END_OF_FILE
  1624. if test 3434 -ne `wc -c <'demo4.asp'`; then
  1625.     echo shar: \"'demo4.asp'\" unpacked with wrong size!
  1626. fi
  1627. # end of 'demo4.asp'
  1628. fi
  1629. if test -f 'demo5.asp' -a "${1}" != "-c" ; then 
  1630.   echo shar: Will not clobber existing file \"'demo5.asp'\"
  1631. else
  1632. echo shar: Extracting \"'demo5.asp'\" \(5152 characters\)
  1633. sed "s/^X//" >'demo5.asp' <<'END_OF_FILE'
  1634. X.letter2 .p .wipe
  1635. X   Now it's my turn to show off and show these upstarts whats IT is all about!
  1636. X
  1637. X.letter3
  1638. X       I spent an hour bolting a few extra effects onto ASP (v3.1) today...
  1639. X
  1640. X.speed 10 .flash .flash .speed 0 .p .wipe
  1641. X                                                             v3.1
  1642. X
  1643. X.letter1 .p
  1644. X  Setting up all sorts of miscellaneous effects which I'm not going to explain.
  1645. X
  1646. X.smooth 1 .scrollob .p
  1647. X   I'll just let you watch what effect they have on the output.  Okey-dokey ?
  1648. X(Oh yes, Alun, I did spot the optimisation. Looks much better now, doesn't it?)
  1649. X
  1650. X.clear .p
  1651. X--
  1652. X
  1653. X.laymte
  1654. X     First things first.
  1655. X                                                     a space invaders gun.
  1656. X                         Kev, your spider looks like
  1657. X
  1658. X.p .p .wipe
  1659. X--
  1660. X
  1661. X.layetm
  1662. X At least my snail LOOKS like a snail.
  1663. X                                        Pity I never brought the centipede out.
  1664. X
  1665. X.p .p .wipe
  1666. X--
  1667. X
  1668. X.foreground
  1669. X[----->                                                                 <-----]
  1670. X
  1671. X.scrollof
  1672. X                   By centipede, of course, I mean this one...
  1673. X
  1674. X.p .scrollob
  1675. X                                                                            --
  1676. X
  1677. X.p .object nmmme -10 80 .anim .resetanim
  1678. X--
  1679. X
  1680. X.foreground
  1681. X
  1682. X.p .p .wipe
  1683. X--
  1684. X
  1685. X.show \
  1686. X.object ----> 0 74 \
  1687. X.object <---- 74 0 \
  1688. X.anim .resetanim \
  1689. X.object ----> 0 74 \
  1690. X.object <---- 74 0 \
  1691. X.anim .resetanim \
  1692. X.show
  1693. X   Forgive me, but I'm going to bring out the flying arrows too. I Like them.
  1694. X
  1695. X.wipe .layf .p .p
  1696. X   I could always get back to basics I suppose. There are a few effects which
  1697. X
  1698. X.wipe .layb .p .p
  1699. X            have been grossly under-used since this .plan war took off.
  1700. X
  1701. X.wipe .spatter .p .p .fade
  1702. XThese poor little effects just sit idle, languishing as an unused ASP operator.
  1703. X                              They need the odd outing.
  1704. X
  1705. X.wipe .scrollf .p .p .wipe
  1706. X                                      Erm...
  1707. X
  1708. X.speed 10 .wspatter .speed 0 .p .wipe
  1709. X       Here's an idea! How about some hippy ethics to help pass the time ?
  1710. X
  1711. X.letter2 .p .wipe
  1712. X         Ban the bomb. I mean, if it's not too much trouble ? Ok, man ?
  1713. X
  1714. X.letter3 .p .wipe
  1715. X                        Ban soap commercials on JANET!
  1716. X                        Ban Baldness. Ban Mathematics.
  1717. X      Ban Hippies. Be Vegetarian. Real Veggie Hippies don't wear Leather.
  1718. X
  1719. X.p .show .clear
  1720. X              <my girlfriend told me this, so it must be true...>
  1721. X
  1722. X.wipe .wspatter .p .p
  1723. X  Hohum. Enough of the little in-jokes. Maybe I just ought to run the credits.
  1724. X
  1725. X.scrollof .p
  1726. X       First and probably least, Alun Jones, alj8. It's all his fault.
  1727. X
  1728. X.scrollob .p
  1729. X And then kkb9, Kev Brooks, for doing such an awful effort I had to do one too.
  1730. X          (He's improved a lot now, by the way. Not TOO much though)
  1731. X
  1732. X.scrollof .p
  1733. X Simon Y Sais, ssw9, who never really got the hang of it, even if it was in 'C'
  1734. X
  1735. X.scrollof
  1736. X      [What IS the difference between C on UNIX and anywhere else, Simon?)
  1737. X
  1738. X.flash .flash .p
  1739. X            IS                        C    UNIX
  1740. X
  1741. X.scrollob .p
  1742. XCarl the hard-coding Hippy (ckw0), and JD (ccs7) for competition and enthusiasm
  1743. X                                  (respectively)
  1744. X
  1745. X.speed 10 .wipe .wspatter .wipe .wspatter .wipe .wspatter .wipe .wspatter .show
  1746. X and all my friends: Gilly, Alun (Baronson), Michelle, Daniel and the Plyn Mob.
  1747. X
  1748. X.flash .flash
  1749. X                     Gilly
  1750. X
  1751. X.wipe .p .show .p .clear
  1752. X               (Now you've had your names in lights, so push off!)
  1753. X
  1754. X.spatter .nl .p .flush
  1755. X     At least I haven't succumbed to the temptation of
  1756. X
  1757. Xsysdd:/var: write failed,  file system full
  1758. X
  1759. Xsysdd:/var: write failed,  file system full
  1760. X
  1761. Xsysdd:/var: write failed,  file system full
  1762. X
  1763. Xsysdd:/var: write failed,  file system full
  1764. X
  1765. Xsysdd:/var: write failed,  file system full
  1766. X
  1767. Xsysdd:/var: write failed,  file system full
  1768. X
  1769. Xsysdd:/var: write failed,  file system full
  1770. X
  1771. Xsysdd:/var: write failed,  file system full
  1772. X
  1773. Xsysdd:/var: write failed,  file system full
  1774. X
  1775. Xsysdd:/var: write failed,  file system full
  1776. X
  1777. Xsysdd:/var: write failed,  file system full
  1778. X
  1779. Xsysdd:/var: write failed,  file system full
  1780. X
  1781. Xsysdd:/var: write failed,  file system full
  1782. X
  1783. Xsysdd:/var: write failed,  file system full
  1784. X
  1785. Xsysdd:/var: write failed,  file system full
  1786. X
  1787. Xsysdd:/var: write failed,  file system full
  1788. X
  1789. Xsysdd:/var: write failed,  file system full
  1790. X
  1791. Xsysdd:/var: write failed,  file system full
  1792. X
  1793. Xsysdd:/var: write failed,  file system full
  1794. X
  1795. Xsysdd:/var: write failed,  file system full
  1796. X
  1797. Xsysdd:/var: write failed,  file system full
  1798. X
  1799. Xsysdd:/var: write failed,  file system full
  1800. X
  1801. Xsysdd:/var: write failed,  file system full
  1802. X
  1803. Xsysdd:/var: write failed,  file system full
  1804. X
  1805. Xsysdd:/var: write failed,  file system full
  1806. X
  1807. Xsysdd:/var: write failed,  file system full
  1808. X
  1809. Xsysdd:/var: write failed,  file system full
  1810. X
  1811. Xsysdd:/var: write failed,  file system full
  1812. X
  1813. Xsysdd:/var: write failed,  file system full
  1814. X
  1815. Xsysdd:/var: write failed,  file system full
  1816. X
  1817. Xsysdd:/var: write failed,  file system full
  1818. X
  1819. Xsysdd:/var: write failed,  file system full
  1820. X
  1821. Xsysdd:/var: write failed,  file system full
  1822. X
  1823. Xsysdd:/var: write failed,  file system full
  1824. X
  1825. Xsysdd:/var: write failed,  file system full
  1826. XConnection closed.
  1827. X
  1828. X.p .p .p .p .p .p
  1829. X--
  1830. X
  1831. X.show .nl
  1832. X                                   <grin!>
  1833. END_OF_FILE
  1834. if test 5152 -ne `wc -c <'demo5.asp'`; then
  1835.     echo shar: \"'demo5.asp'\" unpacked with wrong size!
  1836. fi
  1837. # end of 'demo5.asp'
  1838. fi
  1839. if test -f 'display.c' -a "${1}" != "-c" ; then 
  1840.   echo shar: Will not clobber existing file \"'display.c'\"
  1841. else
  1842. echo shar: Extracting \"'display.c'\" \(4191 characters\)
  1843. sed "s/^X//" >'display.c' <<'END_OF_FILE'
  1844. X/*
  1845. X * This code is copyright ADE Muffett, September 1991, and is distributed as
  1846. X * part of the ASP .plan description language compiler.  This code is freely
  1847. X * redistributable as long as this copyright notice remains intact. No
  1848. X * responsibility is assumed by the author for any situation which arises
  1849. X * from the use of this code, including insanity, late nights, or disk
  1850. X * storage problems.
  1851. X */
  1852. X
  1853. X#include "asp.h"
  1854. X#undef DEBUG
  1855. X
  1856. Xstatic char currline[SCREENWIDTH + 1];    /* The state of the union... */
  1857. X
  1858. X/* nothing */
  1859. Xvoid
  1860. XNoop ()
  1861. X{
  1862. X}
  1863. X/* Throw a newline */
  1864. Xvoid
  1865. XLineFeed ()
  1866. X{
  1867. X    static char lf = '\n';
  1868. X
  1869. X    putchar (lf);
  1870. X    NullSet (currline, sizeof (currline));
  1871. X    SpaceFlood (currline, sizeof (currline));
  1872. X    currline[SCREENWIDTH] = '\0';
  1873. X}
  1874. X/* Throw a carriage return */
  1875. Xvoid
  1876. XCReturn ()
  1877. X{
  1878. X    static char cr = '\r';
  1879. X
  1880. X    putchar (cr);
  1881. X}
  1882. X/* Fast clear of the current line */
  1883. Xvoid
  1884. XWipe ()
  1885. X{
  1886. X    NullSet (stdline, sizeof (stdline));
  1887. X}
  1888. X/* Fast clear of the current line */
  1889. Xvoid
  1890. XClear ()
  1891. X{
  1892. X    Wipe ();
  1893. X    UpdateCR ();
  1894. X}
  1895. X/* show something onto screen destructively */
  1896. Xvoid
  1897. XShow (cstring, dstring)
  1898. X    char *cstring;
  1899. X    char *dstring;
  1900. X{
  1901. X    Wipe ();
  1902. X    Overlay (stdline, dstring);
  1903. X    UpdateCR ();
  1904. X}
  1905. X/* show something onto screen non destructively */
  1906. Xvoid
  1907. XTShow (cstring, dstring)
  1908. X    char *cstring;
  1909. X    char *dstring;
  1910. X{
  1911. X    TransparentOverlay (stdline, dstring);
  1912. X    UpdateCR ();
  1913. X}
  1914. X/* Pause about 1 second @ 9600 baud */
  1915. Xvoid
  1916. XPause ()
  1917. X{
  1918. X    register int i;
  1919. X
  1920. X    for (i = 0; i < LOOP_COUNT; i++)
  1921. X    {
  1922. X    CReturn ();
  1923. X    }
  1924. X    for (i = (LOOP_COUNT * (speed / DUMMY_RETURNS)); i; i--)
  1925. X    {
  1926. X    CReturn ();
  1927. X    }
  1928. X}
  1929. X/* Trim off all whitespace from a text line */
  1930. Xvoid
  1931. XTrim (ptr)
  1932. X    register char *ptr;
  1933. X{
  1934. X    while (*ptr)
  1935. X    {
  1936. X    ptr++;
  1937. X    }
  1938. X    while (isspace (*(--ptr)));
  1939. X    *(++ptr) = '\0';
  1940. X}
  1941. X/* the display primitive */
  1942. Xint
  1943. XUpdate ()
  1944. X{
  1945. X    register int i;
  1946. X    int j;
  1947. X    int print_anim;
  1948. X    int print_stdline;
  1949. X    char diffline[SCREENWIDTH + 1];
  1950. X
  1951. X    /* fix up all spaces */
  1952. X    SpaceFlood (background, SCREENWIDTH);
  1953. X    background[SCREENWIDTH] = '\0';
  1954. X    Trim (background);
  1955. X
  1956. X    SpaceFlood (stdline, SCREENWIDTH);
  1957. X    stdline[SCREENWIDTH] = '\0';
  1958. X    Trim (stdline);
  1959. X
  1960. X    SpaceFlood (anim_buffer, SCREENWIDTH);
  1961. X    anim_buffer[SCREENWIDTH] = '\0';
  1962. X    Trim (anim_buffer);
  1963. X
  1964. X    SpaceFlood (foreground, SCREENWIDTH);
  1965. X    foreground[SCREENWIDTH] = '\0';
  1966. X    Trim (foreground);
  1967. X
  1968. X#ifdef DEBUG
  1969. X    printf ("bg'%s'\n", background);
  1970. X    printf ("st'%s'\n", stdline);
  1971. X    printf ("ab'%s'\n", anim_buffer);
  1972. X    printf ("fg'%s'\n", foreground);
  1973. X#endif
  1974. X
  1975. X    /* zero the differences buffer */
  1976. X    NullSet (diffline, sizeof (diffline));
  1977. X    SpaceFlood (diffline, SCREENWIDTH);
  1978. X    diffline[SCREENWIDTH] = '\0';
  1979. X
  1980. X    TransparentOverlay (diffline, background);
  1981. X    TransparentOverlay (diffline, stdline);
  1982. X    TransparentOverlay (diffline, anim_buffer);
  1983. X    TransparentOverlay (diffline, foreground);
  1984. X    Trim (diffline);
  1985. X
  1986. X    /* and tidy up the memory copy of the current line */
  1987. X    Trim (currline);        /* this is what the screen is */
  1988. X
  1989. X    i = strlen (diffline);
  1990. X    j = strlen (currline);
  1991. X    if (i < j)
  1992. X    {
  1993. X    for (; i < j && i < SCREENWIDTH; i++)
  1994. X    {
  1995. X        diffline[i] = ' ';
  1996. X    }
  1997. X    diffline[j] = '\0';
  1998. X    }
  1999. X    diffline[SCREENWIDTH] = '\0';
  2000. X
  2001. X    /* there is a difference between screen and stdline+overstrikes */
  2002. X    if (strcmp (currline, diffline))
  2003. X    {
  2004. X    char printline[SCREENWIDTH + 1];
  2005. X
  2006. X    /* backup diffline */
  2007. X    Memcpy (printline, diffline, sizeof (printline));
  2008. X
  2009. X    /* don't print common trailing characters except space */
  2010. X    if ((i = strlen (currline)) == strlen (diffline))
  2011. X    {
  2012. X        while (i-- && (diffline[i] == currline[i]))
  2013. X        {
  2014. X        printline[i] = '\0';
  2015. X        }
  2016. X    }
  2017. X    /* print only what is necessary to make changes */
  2018. X    printf ("%s", printline);
  2019. X
  2020. X    /* make diffline the current line */
  2021. X    Memcpy (currline, diffline, sizeof (currline));
  2022. X
  2023. X    /* fill out line */
  2024. X    return (strlen (printline));
  2025. X    } else
  2026. X    {
  2027. X    return (SCREENWIDTH);
  2028. X    }
  2029. X}
  2030. X/* save typing */
  2031. Xvoid
  2032. XUpdateCR ()
  2033. X{
  2034. X    register int i;
  2035. X
  2036. X    i = Update ();
  2037. X    CReturn ();
  2038. X
  2039. X    while (smooth && (i++ < SCREENWIDTH))
  2040. X    {
  2041. X    CReturn ();
  2042. X    }
  2043. X
  2044. X    for (i = 0; i < (speed * DUMMY_RETURNS); i++)
  2045. X    {
  2046. X    CReturn ();
  2047. X    }
  2048. X}
  2049. X/* END OF DISPLAY PRIMITIVES */
  2050. END_OF_FILE
  2051. if test 4191 -ne `wc -c <'display.c'`; then
  2052.     echo shar: \"'display.c'\" unpacked with wrong size!
  2053. fi
  2054. # end of 'display.c'
  2055. fi
  2056. echo shar: End of archive 1 \(of 2\).
  2057. cp /dev/null ark1isdone
  2058. MISSING=""
  2059. for I in 1 2 ; do
  2060.     if test ! -f ark${I}isdone ; then
  2061.     MISSING="${MISSING} ${I}"
  2062.     fi
  2063. done
  2064. if test "${MISSING}" = "" ; then
  2065.     echo You have unpacked both archives.
  2066.     rm -f ark[1-9]isdone
  2067. else
  2068.     echo You still need to unpack the following archives:
  2069.     echo "        " ${MISSING}
  2070. fi
  2071. ##  End of shell archive.
  2072. exit 0
  2073. exit 0 # Just in case...
  2074. -- 
  2075. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2076. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2077. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2078. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2079.